#include "UserLogin.h"
#include "ui_UserLogin.h"
#include "mainwindow.h"
#include <QFontDatabase>
UserLogin::UserLogin(QWidget *parent) :
    BasicWindow(parent),
    ui(new Ui::UserLogin)
{
    ui->setupUi(this);
    setAttribute(Qt::WA_DeleteOnClose);
    initTitleBar();
//    setTitleBarTitle("", ":/Resources/MainWindow/qqlogoclassic.png");
    loadStyleSheet("UserLogin");
    initControl();
}

UserLogin::~UserLogin()
{
    delete ui;
}

void UserLogin::initControl()
{
    QLabel *headlabel = new QLabel(this);
    headlabel->setFixedSize(68, 68);
    QPixmap pix(":/Resources/MainWindow/head_mask.png");
    headlabel->setPixmap(getRoundImage(QPixmap(":/Resources/MainWindow/girl.png"), pix, headlabel->size()));
    headlabel->move(width() / 2 - 34, ui->titleWidget->height() - 34);
    connect(ui->loginBtn, &QPushButton::clicked, this, &UserLogin::onLoginBtnClicked);
}

void UserLogin::onLoginBtnClicked()
{
    close();
    MainWindow* mainwindow = new MainWindow;
    mainwindow->show();
}
